<!-- 商品详情导航 -->
<template>
	<view class="nav">
		<!-- <u-loading size="50"></u-loading> -->
		<map style="width: 750rpx; height: 100vh" :latitude="latitude" :longitude="longitude" scale="16"
		show-location="true" >
		</map>
		<view class="info">
			<view class="name">{{seller.name}}</view>
			<view class="place">({{seller.place}})</view>
			<view class="address">{{seller.address}}</view>
		</view>
		<btn :btn="btn"></btn>
	</view>
</template>
<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from 'vuex';
	export default {
		data() {
			return {
				address: "",
				latitude: "",
				longitude: "",
				btn: "到这去",
				info: {
					id: "",
					name: "虾痴小龙虾",
					place: "东海湾亲子广场",
					address: "福建省 泉州市 丰泽区·东海泰禾广场2楼088号"
				},
				key: "b3a6d94905ea8f2aad51f490a77d9b26"
			};
		},
		mounted() {},
		computed: {
			...mapState({
				seller: state => state.init.notice_detail,
			}),
		},
		onLoad(val) {
			this.address = val.address;
			// 请求高德api后端，将地址转经纬度
			uni.request({
					url: 'https://restapi.amap.com/v3/geocode/geo?parameters',
					method: 'GET',
					data: {
						key: "4c68ea9aeac446dfae048ef70dfa8b09",
						address: this.address
					},
					success: (res) => {
						let data = res.data.geocodes[0].location;
						this.longitude = data.split(',')[0];
						this.latitude = data.split(',')[1];
					}
			})
		},
		methods: {}
	}
</script>
<style scoped lang="scss">
	@import './index.scss';
</style>
